const model = {
  namespace: 'home',
  state: {
    num: 0,
  },
  // 立即执行
  subscriptions: {
    eventTest(dispatch){}
  },
  // 异步
  effects: {
    *fetch({ payload }, { call, put }){
      // 调用 reducers.save
      yield put({ type: 'svae' });
    },
  },
  // 同步
  reducers: {
    save(state, action){
      return { ...state, ...action.payload };
    },
    add(state){
      return { ...state, num: state.num+1 };
    },
    sub(state){
      return { ...state, num: state.num-1};
    }
  }
};

export default model;
